package powerControl.web.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class LoginInterceptor extends AbstractInterceptor{
	
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		String result = "";//定义结果字符串
		Map session = invocation.getInvocationContext().getSession();
		if (session.get("loginUser") == null ) {
			result = ActionSupport.LOGIN;//未登录用户转到登录页
		}else {
			result = invocation.invoke();//已登录用户继续执行
		}
		return result;
	}
	
}